#region Copyright
/// <copyright>
/// Copyright (c) 2007 Ilia Shramko.
/// Released under the terms of the GNU General Public License.
/// </copyright>
#endregion

using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Runtime.InteropServices;
using System.Text;

namespace Osh.Configuration
{
	[ConfigurationCollection(typeof(KeyElement), AddItemName = "key",
		CollectionType = ConfigurationElementCollectionType.AddRemoveClearMap)]
	[ClassInterface(ClassInterfaceType.None)]
	public class KeyCollection : ConfigurationElementCollection, IConfigurationElementCollection
	{
		public KeyCollection()
		{
		}

		protected override System.Configuration.ConfigurationElement CreateNewElement()
		{
			return new KeyElement();
		}

		protected override object GetElementKey(System.Configuration.ConfigurationElement element)
		{
			return ((KeyElement)element).Name;
		}

		public void Add(KeyElement key)
		{
			BaseAdd(key);
		}


		#region IConfigurationElementCollection Members
		public new int Count
		{
			get { return base.Count; }
		}

		public new IEnumerator GetEnumerator()
		{
			return base.GetEnumerator();
		}
		#endregion IConfigurationElementCollection Members
	}
}
